package 线程1;
//线程的创建
//4.实现Runnable,重写run,使用匿名内部类
public class ThreadDemo5 {
    public static void main(String[] args) {
//        创建了匿名内部类的实例,把这个匿名内部类作为参数
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                while(true){
                    System.out.println("hello thread");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        t.start();
    }
}
